Skip to content
This repository was archived by the owner on Sep 14, 2019. It is now read-only.

PID, Drivetrain, cleanup, other little things#41

Merged
lhmcgann merged 9 commits intoDeepBlueRobotics:masterfrom
lhmcgann:master
Feb 1, 2018
Merged

PID, Drivetrain, cleanup, other little things#41
lhmcgann merged 9 commits intoDeepBlueRobotics:masterfrom
lhmcgann:master

Conversation

@lhmcgann
Copy link
Copy Markdown
Contributor

  • implemented velocity PID controllers: class, RobotMap, DT
  • centralized move and turn PID controllers in respective commands -->
    deleted them from RobotMap and their methods from Drivetrain
  • made some more things InstantCommands
  • tests for velocity controllers and new PIDSourceAverage class
  • no tests for PIDMove or PIDTurn commands bc don't know how to get around
    need for SmartDashboard/NetworkTables
  • deleted gyro stuff bc we don't need/use it: have the ahrs
  • deleted LeftDrive and RightDrive classes and references in Robot
  • general cleanup of Drivetrain and its interface
  • deleted some auto-generated comments

implemented velocity PID controllers: class, RobotMap, DT
centralized move and turn PID controllers in respective commands -->
deleted them from RobotMap and their methods from Drivetrain
made some more things InstantCommands
tests for velocity controllers and new PIDSourceAverage class
no tests for PIDMove or PIDTurn commands bc don't know how to get around
need for SmartDashboard/NetworkTables
deleted gyro stuff bc we don't need/use it: have the ahrs
deleted LeftDrive and RightDrive classes and references in Robot
general cleanup of Drivetrain and its interface
@lhmcgann lhmcgann requested a review from brettle January 29, 2018 04:20
https://github.com/DeepBlueRobotics/RobotCode2018.git

Conflicts:
	Robot2018/src/org/usfirst/frc/team199/Robot2018/RobotMap.java
	Robot2018/src/org/usfirst/frc/team199/Robot2018/autonomous/VelocityPIDController.java

hopefully this resolves the conflicts w/ Kate's merge :/
leftEncDist.setPIDSourceType(PIDSourceType.kDisplacement);
leftEncRate = new Encoder(leftEncPort1, leftEncPort2);
leftEncRate.setPIDSourceType(PIDSourceType.kRate);
dtLeftDrive = new WPI_TalonSRX(getPort("LeftTalonSRXDrive", 0));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recommend changing the names of dtLeftDrive and dtRightDrive (and the associated pref names) to use the term "master" instead of "drive" to avoid confusion with the dtLeft and dtRight. Also, if there isn't a good reason to make the master and slave motor controller variables public, they should be private.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will probably be reorganizing the whole component instantiation setup, trying to remove statics and push everything possible into respective subsystems. So i'm going to leave it for now but expect to change the whole thing soon (see issue #49)

leftVelocityController.setInputRange(0, Double.MAX_VALUE);
leftVelocityController.setOutputRange(-1.0, 1.0);
leftVelocityController.setContinuous(false);
leftVelocityController.setAbsoluteTolerance(Robot.getConst("ConstMoveToleranceLeft", 2));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the above uses of the word "move" be changed to "velocity"?

* @param output
* the SpeedController you are telling what to do
*/
public VelocityPIDController(double kp, double ki, double kd, PIDSource source, SpeedControllerGroup output) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should also pass in kf, or even better, the info needed to compute kf.

}
assertEquals(avg.getPIDSourceType(), PIDSourceType.kRate);
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add at least one test that verifies that it does actually return the average of the 2 sources.

bc .gitignore stuff from testing-no-auto
VelocityPIDController: added constructor param and javadoc
RobotMap: initial instantiation
Drivetrain: updatePIDConstants method
added f in VelocityPIDController constructors to resolve errors
added test to PIDSourceAverageTest to make sure it actually returns the
average
per Corvin's suggestion in order to clarify and leave no room for
confusion about what is what (e.g. button was called PIDMove but so was
the command it was calling; changed to PIDMoveButton, etc.)
yeah, I know the names are long, but you know exactly what they are :)
all in RobotMap
changed TalonSRX dt motor controller names from Drive -> Master per
request by Dean
forgot to delete actual AnalogGyro in RobotMap, so did that
@lhmcgann
Copy link
Copy Markdown
Contributor Author

@brettle Do you know the purpose/use of the kOff DoubleSolenoid.Value? I know it sets the solenoid to neutral but I was unsure why/when it would be used. I asked bc in this PR I changed shifting gears commands to InstantCommands, but @doawelul had commented in issue #31 about not doing so in order to set the solenoid to kOff after shifting. I tried looking online but it wasn't very helpful, so I was wondering if you knew? --> Is holding in KForward or kReverse ok? --> Is shifting directly from kForward to kReverse and back ok? --> Is changing the shifting gear to InstantCommands ok?

@lhmcgann
Copy link
Copy Markdown
Contributor Author

@brettle
Copy link
Copy Markdown
Member

brettle commented Jan 30, 2018

Holding kForward or kReverse should be fine. The solenoid should only draw a small fraction of an amp.
There also shouldn't be any problem with shifting directly between kForward and kReverse. Using InstantCommands for shifting is what I would recommend.

@lhmcgann
Copy link
Copy Markdown
Contributor Author

Ok, cool, thank you. 👍

@lhmcgann lhmcgann merged commit 52a5c61 into DeepBlueRobotics:master Feb 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants